package top.tagao.m02_creationalPatterns.c_02_singleton;

/** 饿汉式 同步方法
 * @author fu-xiao-liu
 * @Date 2022/6/22 23:32
 */
public class Singleton2 {

    private  Singleton2(){
    }

    private volatile  static  Singleton2 s2;

    public  static synchronized  Singleton2  getInstance(){
        if (s2 == null) {
            s2 = new Singleton2();
        }
        return s2;
    }

}
